package com.hbyj.object;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.aspectj.weaver.patterns.ThisOrTargetAnnotationPointcut;

import com.hbyj.db.function.DbTools;
import com.hbyj.hbm.vo.Departments;
import com.hbyj.hbm.vo.MemberRole;
import com.hbyj.hbm.vo.Members;
import com.hbyj.hbm.vo.Roles;

public class MemberUpdateObject {
	private Integer id;
	private String member_department;
	private String member_name;
	private String member_empName;
	private String member_remark;
	private String member_role;
	
	public MemberUpdateObject(){
		
	}
	
	public Members GetMembers(){
		Members members =new Members();
		List memberList = DbTools.findByProperty("Members", "id", this.id);
		members = (Members)memberList.get(0);
		
		members.setName(this.member_name);
		members.setEmpName(this.member_empName);
		members.setRemarks(this.member_remark);
		
		Departments department = (Departments)DbTools.findByHql("from Departments department where department.id='"+this.member_department+"'").get(0);
		members.setDepartments(department);
		members.setLyCode(department.getRegionCode());
		
		Roles roles=(Roles)(DbTools.findByHql("from Roles role where role.id='"+this.member_role+"'").get(0));
		//Roles roles = (Roles)(DbTools.findByProperty("Roles", "id", this.member_role).get(0));
		MemberRole memberRole=(MemberRole)DbTools.findByProperty("MemberRole", "id", this.id).get(0);
		
		memberRole.setRoles(roles);

		DbTools.saveOrUpdateObj(memberRole);
		return members;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	public void setMember_department(String member_department) {
		this.member_department = member_department;
	}
	public String getMember_department() {
		return member_department;
	}
	public void setMember_name(String member_name) {
		this.member_name = member_name;
	}
	public String getMember_name() {
		return member_name;
	}
	public void setMember_remark(String member_remark) {
		this.member_remark = member_remark;
	}
	public String getMember_remark() {
		return member_remark;
	}
	public void setMember_role(String member_role) {
		this.member_role = member_role;
	}
	public String getMember_role() {
		return member_role;
	}

	public String getMember_empName() {
		return member_empName;
	}

	public void setMember_empName(String memberEmpName) {
		member_empName = memberEmpName;
	}
	
}
